#include "Include.h"


class RelayPIDOutput : public PIDOutput {
public:
	RelayPIDOutput(UINT8 _module, UINT32 _channel) {
		m_relay = new Relay(_module, _channel);
	}
	RelayPIDOutput(Relay *_relay) {
		m_relay = _relay;
	}
	void PIDWrite(float _value) {
		if(_value > m_threshold) {
			m_relayValue = Relay::kForward;
		}
		else if(_value < m_threshold) {
			m_relayValue = Relay::kReverse;
		}
		else {
			m_relayValue = Relay::kOff;
		}
		m_relay->Set(m_relayValue);
	}
	
	Relay::Value Get()
	{
		return m_relayValue;
	}
private:
	Relay::Value m_relayValue;
	Relay *m_relay;
	static const float m_threshold = 0.0;
};
